//    Copyright (C) Kherty.  All rights reserved.
using System;
using System.Collections.Generic;

namespace OpenLS.Chart.UI
{
    class Helper
    {
        public static double Max<T>(IEnumerable<T> e, FuncDouble<T> f)
        {
            double result = double.MinValue;
            foreach (T t in e)
            {
                result = Math.Max(f(t), result);
            }
            return result;
        }
        public static double Min<T>(IEnumerable<T> e, FuncDouble<T> f)
        {
            double result = double.MaxValue;
            foreach (T t in e)
            {
                result = Math.Min(f(t), result);
            }
            return result;
        }
    }

    internal delegate double FuncDouble<T>(T t);
}
